package cn.com.nou.common;

//import cn.com.nou.common.codelist.MybatisCodelistInterceptor;
//import cn.com.nou.common.codelist.MybatisEnumInterceptor;
import cn.com.nou.common.dao.CommonEnumerationDAO;
//import cn.com.nou.common.upload.UploadClient;
//import cn.com.nou.common.upload.UploadClientImpl;
import cn.com.nou.common.utils.SpringContextUtils;

//import com.github.tobato.fastdfs.FdfsClientConfig;
//import com.github.tobato.fastdfs.service.FastFileStorageClient;
//import feign.RequestInterceptor;
//import feign.RequestTemplate;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * CommonConfiguration
 * @author lixuefeng
 */
@Configuration
//@Import(FdfsClientConfig.class)
public class CommonConfiguration {

//    @DependsOn("sqlSessionTemplate")
//    @ConditionalOnBean(SqlSessionTemplate.class)
    @Bean
    public CommonEnumerationDAO createEnumerationDAO(SqlSessionTemplate sqlSessionTemplate) {
        CommonEnumerationDAO enumerationDAO = new CommonEnumerationDAO();
        enumerationDAO.setSqlSessionTemplate(sqlSessionTemplate);
        return enumerationDAO;
    }
//    @Mapper
//
//    @Bean
//    public MybatisCodelistInterceptor createInterceptor() {
//        MybatisCodelistInterceptor interceptor = new MybatisCodelistInterceptor();
//        return interceptor;
//    }

//    @Bean
//    public MybatisEnumInterceptor mybatisEnumInterceptor() {
//        return new MybatisEnumInterceptor();
//    }

    @Bean
    public SpringContextUtils getSpringContext() {
        return new SpringContextUtils();
    }

//    @Bean
//    public UploadClient uploadClient(FastFileStorageClient client) {
//        return new UploadClientImpl(client);
//    }

}
